import { IPSDEMethodDTO } from './ipsdemethod-dto';
import { IPSDEServiceAPI } from './ipsdeservice-api';
import { IPSDEServiceAPIField } from './ipsdeservice-apifield';
import { IPSDEServiceAPIMethodInput } from './ipsdeservice-apimethod-input';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEServiceAPIMethodInputImpl extends PSModelObjectImpl implements IPSDEServiceAPIMethodInput {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  protected keypsdeserviceapifield: IPSDEServiceAPIField | null = null;

  getKeyPSDEServiceAPIField(): IPSDEServiceAPIField | null {
    if (this.keypsdeserviceapifield != null) return this.keypsdeserviceapifield;
    const value = this.M.getKeyPSDEServiceAPIField;
    if (value == null) {
      return null;
    }
    const ipsdeserviceapi = this.getParentPSModelObject('dataentity.service.IPSDEServiceAPI') as IPSDEServiceAPI;
    if (ipsdeserviceapi != null) {
      this.keypsdeserviceapifield = ipsdeserviceapi.findPSDEServiceAPIField(value);
    }
    return this.keypsdeserviceapifield;
  }

  get keyPSDEServiceAPIField(): IPSDEServiceAPIField | null {
    return this.getKeyPSDEServiceAPIField();
  }

  getKeyPSDEServiceAPIFieldMust(): IPSDEServiceAPIField {
    const value = this.getKeyPSDEServiceAPIField();
    if (value == null) {
      throw new Error('未指定实体服务接口主键属性');
    }
    return value;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected psdemethoddto: IPSDEMethodDTO | null = null;

  getPSDEMethodDTO(): IPSDEMethodDTO | null {
    if (this.psdemethoddto != null) return this.psdemethoddto;
    const value = this.M.getPSDEMethodDTO;
    if (value == null) {
      return null;
    }
    const ipsdeserviceapi = this.getParentPSModelObject('dataentity.service.IPSDEServiceAPI') as IPSDEServiceAPI;
    if (ipsdeserviceapi != null) {
      this.psdemethoddto = ipsdeserviceapi.getPSDataEntityMust().findPSDEMethodDTO(value);
    }
    return this.psdemethoddto;
  }

  get psDEMethodDTO(): IPSDEMethodDTO | null {
    return this.getPSDEMethodDTO();
  }

  getPSDEMethodDTOMust(): IPSDEMethodDTO {
    const value = this.getPSDEMethodDTO();
    if (value == null) {
      throw new Error('未指定实体服务接口DTO对象');
    }
    return value;
  }

  get type(): 'NONE' | 'KEYFIELD' | 'KEYFIELDS' | 'DTO' | 'DTOS' | 'UNKNOWN' | 'USER' | 'USER2' {
    return this.M.type;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSDEServiceAPIMethodInputImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.service.IPSDEMethodInput' || cls == 'dataentity.service.IPSDEServiceAPIMethodInput') return true;
    return super.instanceof(cls);
  }
}
